/**
 *
 * User: Zhikang.Peng
 * Date: 2018/04/10 15:39
 */
package loads

import (
	"gitee.com/thghh/jvmgo/instructions/base"
	"gitee.com/thghh/jvmgo/rtda"
)

//将指定的long型本地变量推送至栈顶
type LLOAD struct{ base.Index8Instruction }

func (self *LLOAD) Execute(frame *rtda.Frame) {
	_lload(frame, uint(self.Index))
}

//将第一个long型本地变量推送至栈顶
type LLOAD_0 struct{ base.NoOperandsInstruction }

func (self *LLOAD_0) Execute(frame *rtda.Frame) {
	_lload(frame, 0)
}

//将第二个long型本地变量推送至栈顶
type LLOAD_1 struct{ base.NoOperandsInstruction }

func (self *LLOAD_1) Execute(frame *rtda.Frame) {
	_lload(frame, 1)
}

//将第三个long型本地变量推送至栈顶
type LLOAD_2 struct{ base.NoOperandsInstruction }

func (self *LLOAD_2) Execute(frame *rtda.Frame) {
	_lload(frame, 2)
}

//将第四个long型本地变量推送至栈顶
type LLOAD_3 struct{ base.NoOperandsInstruction }

func (self *LLOAD_3) Execute(frame *rtda.Frame) {
	_lload(frame, 3)
}

func _lload(frame *rtda.Frame, index uint) {
	val := frame.LocalVars().GetLong(index)
	frame.OperandStack().PushLong(val)
}
